﻿@using LayuiMvc.Logic.LogicEnum
@model LayuiMvcUtil.Result.DataResult<List<LayuiMvc.DataModel.Community.PostListModel>>

@Html.Action("PostType", "Post", new { postType=ViewBag.PostType})

<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <!--左侧帖子列表-->
        <div class="layui-col-xs8">
            <div class="fly-panel">
                <!--帖子状态及排序-->
                <div class="fly-panel-title fly-filter">
                    <a href="@Url.Action("Index",new { postType=ViewBag.PostType,postSort=ViewBag.PostSort})"
                       class="@(ViewBag.PostStatus==PostStatusQueryEnum.None?"layui.this":"")">综合</a>
                    <a href="@Url.Action("Index",new { postType=ViewBag.PostType,postSort=ViewBag.PostSort,postStatus=PostStatusQueryEnum.End})"
                       class="@(ViewBag.PostStatus==PostStatusQueryEnum.End?"layui.this":"")">已结</a>
                    <a href="@Url.Action("Index",new { postType=ViewBag.PostType,postSort=ViewBag.PostSort,postStatus=PostStatusQueryEnum.UnEnd})"
                       class="@(ViewBag.PostStatus==PostStatusQueryEnum.UnEnd?"layui.this":"")">未结</a>
                    <a href="@Url.Action("Index",new { postType=ViewBag.PostType,postSort=ViewBag.PostSort,postStatus=PostStatusQueryEnum.Cream})"
                       class="@(ViewBag.PostStatus==PostStatusQueryEnum.Cream?"layui.this":"")">精帖</a>

                    <div class="fly-filter-right">
                        <a href="@Url.Action("Index",new {postType=ViewBag.PostType,postStatus=ViewBag.PostStatus,postSort=PostSortQueryEnum.New })"
                           class="@(ViewBag.PostSort==PostSortQueryEnum.New?"layui-this":"")">按最新</a>
                        <span class="fly-mid"></span>
                        <a href="@Url.Action("Index",new {postType=ViewBag.PostType,postStatus=ViewBag.PostStatus,postSort=PostSortQueryEnum.Hot })"
                           class="@(ViewBag.PostSort==PostSortQueryEnum.Hot?"layui-this":"")">按最热</a>
                    </div>
                </div>

                <!--帖子列表-->
                <ul class="fly-list">
                   @foreach(var post in Model.data)
                   {
                       <li>
                           <!--帖子发布者信息-->
                           <a href="@Url.Action("UserCenter","User",new {userId=post.UserId })" class="fly-avatar">
                               <img src="@post.HeadImgUrl"/>
                           </a>
                           <h2 style="display: flex; align-items: center;">
                               <span class="layui-badge">@post.PostTypeStr</span>
                               <a href="@Url.Action("Detail","Post",new { postId=post.PostId})">@post.Title</a>
                           </h2>
                           <div class="fly-list-info">
                               <a href="@Url.Action("UserCenter","User",new { userId=post.UserId})">
                                   <cite>@post.NickName</cite>
                               </a>
                               @if (post.IsApprove)
                               {
                                  <i class="iconfont icon-renzheng" title="认证信息:@post.ApproveMsg"></i>
                               }
                                  <i class="layui-badge fly-badge-vip">@post.UserIdentityStr</i>
                               <span>@post.PublishTimeSpan</span>
                               @if (post.IsEnd)
	                            {
		                            <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
	                            }
                               <span class="fly-list-nums">
                                   <i class="iconfont icon-pinglun1"></i>@post.ReplyCount
                               </span>
                           </div>

                           <div class="fly-list-badge">
                               @if (post.IsTop)
                               {
                                   <span class="layui-badge layui-bg-black">置顶</span>
                               }
                               @if (post.IsCream)
                               {
                                   <span class="layui-badge layui-bg-red">精帖</span>
                               }
                           </div>
                       </li>
                   }
                </ul>
                <div style="text-align:center">
                    <div id="postPage"></div>
                </div>
            </div>
        </div>
        <!--右侧广告-->
        <div class="layui-col-md4">
            <div class="fly-panel">
                <div class="fly-panel-title">
                    RC主页
                </div>
                <div class="fly-panel-main">
                    <a href="https://xiketang.ke.qq.com" target="_blank" class="fly-zanzhu" time-limt="2019-2020" style="background-color:#5FB878;">进阶</a>
                </div>
            </div>

            <div class="fly-panel"style="padding:20px 0; text-align:center;" >
                <img src="~/Content/image/weixin.jpg" style="max-width:100%;" alt="layui" />
                <p style="position:relative;color:#666;">微信扫码关注</p>
            </div>

        </div>
    </div>
</div>

<script type="text/javascript">
    layui.cache.module={
        moduleName:'post',
        pageName:'listPage',
        totalCount:@Model.count,
        pageIndex:@Model.page,
        postType: '@ViewBag.PostType',
        postStatus: '@ViewBag.PostStatus',
        postSort:'@ViewBag.PostSort'
    }
</script>